package com.zzyweb.rentalcarsys.mapper;

import com.zzyweb.rentalcarsys.entity.viewobject.UserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserVOMapper {
    @Select("select ua.id, ua.username,ua.email,ua.phone_number,ui.full_name,ui.identity_number,ui.profile_picture,ui.is_delete " +
            "from user_account ua " +
            "join user_info ui on ua.id = ui.user_id where ui.is_delete = 0 ")
    List<UserVO> getAllUser();

    @Select("select ua.id, ua.username,ua.email,ua.phone_number,ui.full_name,ui.identity_number,ui.profile_picture,ui.is_delete " +
            "from user_account ua " +
            "join user_info ui on ua.id = ui.user_id where ui.is_delete = 0 " +
            "and ua.id = #{userId}")
    UserVO selectUserVO(Long userId);
}
